﻿using System;
using System.Text;
using IAM.Interface.Model.Interface;

namespace IAM.Interface.Model
{
    /// <summary>
    /// 用户和该用户的代理信息列表
    /// </summary>
    public class AIDelegations : AbstractConvertObject, IConvertXml
    {
        
        #region 属性
        private AccountInfo _accountinfo = null;
        private Delegations _delegations = null;
        /// <summary>
        /// 人员帐号信息
        /// </summary>
        public AccountInfo AccountInfo
        {
            get
            {
                return _accountinfo;
            }
            set
            {

                _accountinfo = value;
            }
        }
        /// <summary>
        /// 人员代理信息
        /// </summary>
        public Delegations Delegations
        {
            get
            {
                return _delegations;
            }
            set
            {
                _delegations = value;
            }
        }
        #endregion
        #region IConvertXml

        public string XMLBoday
        {
            get
            {
                StringBuilder _xml = new StringBuilder();
                _xml.Append(this.AccountInfo.XML);
                _xml.Append(this.Delegations.XML);
               
                return _xml.ToString();
            }


        }

        public string XMLFinis
        {
            get
            {
                return "";
            }
        }
        public string XML
        {
            get
            {
                return XMLBoday + XMLFinis;
            }
        }
        #endregion
        #region AbstractConvertObject
        public override object ConvertToObject()
        {
            this.AccountInfo = new AccountInfo();
            this.AccountInfo.CurrentXmlNode = this.CurrentXmlNode.SelectSingleNode("AccountInfo");
            this.AccountInfo = (AccountInfo)this.AccountInfo.ConvertToObject();

            this.Delegations = new Delegations();
            this.Delegations.CurrentXmlNode = this.CurrentXmlNode.SelectSingleNode("Delegations");
            this.Delegations = (Delegations)this.Delegations.ConvertToObject();
            return this;
        }
        #endregion
    }
}
